﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <title>Index</title>
    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.7.1.min.js"></script>
    <script src="~/Content/validBox/validBox.js"></script>
    <script type="text/javascript">
        function upLoadCallBack(img) {
            $('#HeadImage').val(img);
        }

        function save() {
            $('form').validBox(function (r) {
                if (r == true) {
                    if (!$('#HeadImage').val()) {
                        alert('提示', '请选择头像图片上传...');
                        return;
                    }

                    $.post('Create', $('form').serialize(), function (data, status) {
                        alert(status);
                    });
                }
            });
        }
    </script>
</head>
<body>
    <form class="form-horizontal">
        <div class="control-group">
            <label class="control-label">姓名</label>
            <div class="controls">
                @Html.TextBox("name", null, Html.Valid().Required().MaxLength(6).AsHtmlAttribute())
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">密码</label>
            <div class="controls">
                @Html.Password("password", null, Html.Valid().Required().Length(6, 12).AsHtmlAttribute())
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">头像</label>
            <div class="controls">
                <iframe required="required" frameborder="0" marginheight="0" marginwidth="0" height="31" width="300" scrolling="no" src="/fileupload/image?callback=parent.upLoadCallBack&width=100&height=80"></iframe>
                <input id="HeadImage" name="HeadImage" type="hidden" />
            </div>
        </div>

        <div class="control-group">
            <div class="controls">
                <a href="javascript:void(0)" class="btn" onclick="save();return false">确定</a>
                <a href="javascript:void(0)" class="btn" onclick="history.go(-1)">返回</a>
            </div>
        </div>
    </form>
</body>
</html>
